package com.gimi.test_jpa.com.gimi.util;

import java.util.List;

public class PageUtil {
    public static PageVo getPageVo(List list, Integer pageNum, Integer pageSize) {
        PageVo page = new PageVo();
        page.setCount(list.size());
        int end;
        if(pageNum*pageSize>list.size()) {
            end = list.size();
        }else {
            end = pageNum*pageSize;
        }
        page.setDataItems(list.subList((pageNum-1)*pageSize,end));
        return page;
    }
}
